package designmodel.strategy.收银策略练习;

import designmodel.strategy.收银策略练习.context.CashContext;
import designmodel.strategy.收银策略练习.strategies.DiscountStrategy;
import designmodel.strategy.收银策略练习.strategies.FullMinusStrategy;
import designmodel.strategy.收银策略练习.strategies.NoneDiscountStrategy;

/**
 *
 * @author scylla
 * @version V1.0
 * @project echo -java-base
 * @title
 * @package designmodel.strategy.收银策略练习
 * @since 2021 /12/16 5:09 下午
 */
public class MainClient {


    /**
     * The entry point of application.
     *
     * @param args the input arguments
     */
    public static void main(String[] args) {
        CashContext cashContext = new CashContext(new NoneDiscountStrategy());

        double needPay = cashContext.getResult(1000);

        System.out.println("共需支付:" + needPay + "元");

        cashContext = new CashContext(new DiscountStrategy.Builder().discountPercent(0.8).build());

        double needPay2 = cashContext.getResult(1000);

        System.out.println("共需支付:" + needPay2 + "元");

        cashContext = new CashContext(new FullMinusStrategy.Builder().fullFactor(300).discountAmount(100).build());

        double needPay3 = cashContext.getResult(301);

        System.out.println("共需支付:" + needPay3 + "元");

    }
}
